#region File Description
//-----------------------------------------------------------------------------
// OptionsMenuScreen.cs
//
// Microsoft XNA Community Game Platform
// Copyright (C) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#endregion

using Microsoft.Xna.Framework;

namespace TestGame {
    /// <summary>
    /// The options screen is brought up to allow the user to decide which 
    /// options should be changed.
    /// </summary>
    class OptionsMenuScreen : MenuScreen {
        #region Fields

        MenuEntry videoOptions;
        MenuEntry soundOptions;
        MenuEntry controlOptions;
        MenuEntry back;

        #endregion

        #region Initialization

        /// <summary>
        /// Constructor.
        /// </summary>
        public OptionsMenuScreen() : base("Options") {
            videoOptions = new MenuEntry("Video Options");
            soundOptions = new MenuEntry("Sound Options");
            controlOptions = new MenuEntry("Control Options");
            back = new MenuEntry("Back");

            // Hook up menu event handlers.
            videoOptions.Selected += OnVideoOptionsSelected;
            soundOptions.Selected += OnSoundOptionsSelected;
            controlOptions.Selected += OnControlOptionsSelected;
            back.Selected += OnCancel;
            
            // Add entries to the menu.
            MenuEntries.Add(videoOptions);
            MenuEntries.Add(soundOptions);
            MenuEntries.Add(controlOptions);
            MenuEntries.Add(back);
        }

        #endregion

        #region Event Handlers

        /// <summary>
        /// Called upon the Video Options MenuEntry being selected.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void OnVideoOptionsSelected(object sender, PlayerIndexEventArgs e) {
            ScreenManager.AddScreen(new VideoOptionsScreen(), e.PlayerIndex);
        }

        /// <summary>
        /// Called upon the Sound Options MenuEntry being selected.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void OnSoundOptionsSelected(object sender, PlayerIndexEventArgs e) {
            ScreenManager.AddScreen(new SoundOptionsScreen(), e.PlayerIndex);
        }

        /// <summary>
        /// Called upon the Control Options MenuEntry being selected.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void OnControlOptionsSelected(object sender, PlayerIndexEventArgs e) {
            ScreenManager.AddScreen(new ControlOptionsScreen(), e.PlayerIndex);
        }

        #endregion
    }
}
